﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Model;
using System.Data;
namespace DAL
{
     public class XMServer
    {
         public static string  sqltext="";
         public static object add(XM xm)
         {
             sqltext="INSERT INTO XM(XMNAME)values('"+xm.XMNAME+"')";
             return SQLHELPER.ExecuteNonQuery(sqltext);
         }
         public static DataSet selectAll()
         {
             sqltext = "SELECT * FROM XM";
             return SQLHELPER.ExecuteDataSet(sqltext);
         }
         /// <summary>
         /// 根据套餐ID ,查询该套餐的所有项目（根据第三个变，（关系表））
         /// </summary>
         /// <param name="tc"></param>
         /// <returns></returns>
         public static DataSet SelectALLXMByTcId(Model.TC tc)
         {
             sqltext = "SELECT [TCNAME], [XMNAME] FROM TC,TCrelativeXM,XM  WHERE TC.TCID='" + tc.TCID + "' AND TCrelativeXM.TCID=TC.TCID AND TCrelativeXM.XMID=XM.XMID";
             return SQLHELPER.ExecuteDataSet(sqltext);
         }
    }
}
